package zsc.liangyi.blog.model.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 博客评论实体类
 * 1、使用定制的RedisConfig配置类，实现缓存时的JSON序列化机制
 */
@Data
public class Comment {
    private Integer id;         // 评论id

    private Integer articleId; // 评论的文章id

    private String content;    // 评论内容

    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private Date created;      // 评论日期

    private String author;     // 评论作者名

    private String ip;          // 评论用户登录ip

    private String status;     // 评论状态，默认审核通过approved

    @Override
    public String toString() {
        return "Comment{" +
                "id=" + id +
                ", articleId=" + articleId +
                ", content='" + content + '\'' +
                ", created=" + created +
                ", author='" + author + '\'' +
                ", ip='" + ip + '\'' +
                ", status='" + status + '\'' +
                '}';
    }
}
